syntax enable
let g:tex_flavor='latex'
let g:vimtex_texcount_custom_arg=' -ch -total'
let g:vimtex_format_enabled = 1
let g:Tex_Leader=';'
"这里是LaTeX编译引擎的设置，这里默认LaTeX编译方式为-pdf(pdfLaTeX),
"vimtex提供了magic comments来为文件设置编译方式
"例如，我在tex文件开头输入 % !TEX program = xelatex   即指定-xelatex （xelatex）编译文件
let g:vimtex_compiler_latexmk_engines = {
    \ '_'                : '-xelatex',
    \ 'pdflatex'         : '-pdf',
    \ 'dvipdfex'         : '-pdfdvi',
    \ 'lualatex'         : '-lualatex',
	\ 'xelatex'          : '-xelatex',
    \ 'context (pdftex)' : '-pdf -pdflatex=texexec',
    \ 'context (luatex)' : '-pdf -pdflatex=context',
    \ 'context (xetex)'  : '-pdf -pdflatex=''texexec --xtx''',
    \}
"这里是设置latexmk工具的可选参数
let g:vimtex_compiler_latexmk = {
    \ 'build_dir' : '',
    \ 'callback' : 1,
    \ 'continuous' : 1,
    \ 'executable' : 'latexmk',
    \ 'hooks' : [],
    \ 'options' : [
    \   '-verbose',
    \   '-file-line-error',
    \   '-shell-escape',
    \   '-synctex=1',
    \   '-interaction=nonstopmode',
    \ ],
    \}

set conceallevel=1
let g:tex_conceal='abdmg'
let g:vimtex_view_general_viewer = 'zathura'
let g:vimtex_view_method = 'zathura'
let g:vimtex_quickfix_mode=0
"编译过程中忽略警告信息
let g:vimtex_quickfix_open_on_warning=0
let g:livepreview_previewer = 'zathura'
nmap <F12> :LLPStartPreview<cr>
let g:Tex_Env_theorem = "\\begin{theorem}\<CR><++>\<CR>\\end{theorem}"
autocmd Filetype tex setl updatetime=1
autocmd Filetype tex nmap <C-e> :VimtexError<CR>
autocmd FileType tex   setlocal spell spelllang=en_us,cjk
autocmd TextChanged,TextChangedI <buffer> silent write
